package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 计算复利
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_30 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter the amount: ");
		double amount=input.nextDouble();
		System.out.print("Enter the Year rate: ");
		double yearRate=input.nextDouble()/100.0;
		double monthRate=yearRate/12.0;
		System.out.print("Enter the number of  month:");
		int nMonth=input.nextInt();
		
		double sum=0;
		for(int i=0;i<nMonth;i++) {
			sum=(amount+sum)*(1+monthRate);
		}
		
		System.out.printf("After %d months is %.2f\n", nMonth,sum);
		
		
	}

}
